package com.heima.task.job;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Date;

@Component
public class HelloJob {

    public  HelloJob(){
        System.out.println("构造方法");
    }

//    @Scheduled(cron = "0/2 * * * * ?") //每2秒执行一次
//    public void refresh(){
//        System.out.println("当前执行时间："+new Date());
//    }

    @PostConstruct //jdk
    public void test(){
        System.out.println("监控对象什么周期 后------------");
    }
}
